package com.karst.essentials.chapter10
{
	import com.karst.essentials.chapter07.galaxyExample.GalaxyExample;
	
	import flash.display.Sprite;
	
	public class Chapter10View extends Sprite
	{
		public static const SECTION_LIST : Array = 
			["粒子材质类——ParticleMaterial", "动态绘制位图BitmapParticleMaterial",
			"加载位图BitmapParticleMaterial", "MovieAssetParticleMaterial(交互性)"
			 ] ;
		
		public function Chapter10View()
		{
			super();
		}
		
		
		public function showSection( $section : String = "" ) : void
		{
			while( numChildren )
				removeChildAt( 0 ) ;
			switch( $section )
			{
				case SECTION_LIST[0] :
					createParticleMaterialExample() ;
					break ;
				case SECTION_LIST[1] :
					createBitmapParticleMaterialShapeExample() ;
					break ;
				case SECTION_LIST[2] :
					createBitmapParticleMaterialImageExample() ;
					break ;
				case SECTION_LIST[3] :
					createMovieAssetParticleMaterialExample() ;
					break ;
			}
		}

		private var particleMaterialExample : ParticleMaterialExample = null ;
		private function createParticleMaterialExample() : void
		{
			if( particleMaterialExample == null )
				particleMaterialExample = new ParticleMaterialExample() ;
			addChild( particleMaterialExample ) ;
		}

		private var bitmapParticleMaterialShapeExample : BitmapParticleMaterialShapeExample = null ;
		private function createBitmapParticleMaterialShapeExample() : void
		{
			if( bitmapParticleMaterialShapeExample == null )
				bitmapParticleMaterialShapeExample = new BitmapParticleMaterialShapeExample() ;
			addChild( bitmapParticleMaterialShapeExample ) ;
		}

		private var bitmapParticleMaterialImageExample : BitmapParticleMaterialImageExample = null ;
		private function createBitmapParticleMaterialImageExample() : void
		{
			if( bitmapParticleMaterialImageExample == null )
				bitmapParticleMaterialImageExample = new BitmapParticleMaterialImageExample() ;
			addChild( bitmapParticleMaterialImageExample ) ;
		}

		private var movieAssetParticleMaterialExample : MovieAssetParticleMaterialExample = null ;
		private function createMovieAssetParticleMaterialExample() : void
		{
			if( movieAssetParticleMaterialExample == null )
				movieAssetParticleMaterialExample = new MovieAssetParticleMaterialExample() ;
			addChild( movieAssetParticleMaterialExample ) ;
		}
	}
}